import { defineStore } from 'pinia'
export const crosshair = defineStore('crosshair',{
    state: () => ({ crosshair:''}),
    getters: {
      val: () => state.crosshair,
    },
    actions: {
      set(crosshair) {
        this.crosshair = crosshair;
      },
    },
  })

export const charts = defineStore('charts', {
    state: () => ({ charts:[]}),
    getters: {
      val: () => state.charts,
    },
    actions: {
      add(chart) {
        this.charts.push(chart);
      },
      remove(chart){
        this.charts = this.charts.filter( v => v != chart);
      }
    },
  })

  export const currentChartId = defineStore('currentChartId', {
    state: () => ({ currentChartId:''}),
    getters: {
      val: () => state.currentChartId,
    },
    actions: {
      set(id){
        this.currentChartId = id;
      }
    }
  })

  export const tradeId = defineStore('tradeId', {
    state: () => ({ tradeId:''}),
    getters: {
      val: (state) => state.tradeId,
    },
    actions: {
      set(id){
        this.tradeId = id;
      }
    }
  })

  export const goodsTradeArray = defineStore('goodsTradeArray', {
    state: () => ({ goodsTradeArray:[]}),
    getters: {
      val: (state) => state.goodsTradeArray,
    },
    actions: {
      set(arr){
        this.goodsTradeArray = arr;
      }
    }
  })

  export const originCrosshair = defineStore('originCrosshair',{
    state: () => ({ originCrosshair:''}),
    getters: {
      val: () => state.originCrosshair,
    },
    actions: {
      set(originCrosshair) {
        this.originCrosshair = originCrosshair;
      },
    },
  })